package com.medord.machine.core;

/**
* 线程类，用于存放审批过程的参数和返回数据
* @param null
* @return
* @author 孙丰佳
* @time 2021-11-18 17:29
*/
public class FlowContextUtil {
    private static ThreadLocal<IFlowProcessParameter> parameterHolder = new ThreadLocal<>();

    static void clear() {
        parameterHolder.remove();
    }

    static IFlowProcessParameter getProcessParameter() {
        return parameterHolder.get();
    }

    static void setProcessParameter(IFlowProcessParameter parameter) {
        parameterHolder.set(parameter);
    }

    static void putInnerPara(Object key, Object value){
        parameterHolder.get().putInnerPara(key, value);
    }

    static Object getInnerPara(Object key){
        return parameterHolder.get().getInnerPara(key);
    }

    static Object getOuterPara(Object key){
        return parameterHolder.get().getOuterPara(key);
    }

    static void addWarningMsg(String msg){
        parameterHolder.get().addWarningMsg(msg);
    }
}
